/**
 * @param {number[][]} coordinates
 * @return {boolean}
 */
var checkStraightLine = function (coordinates) {
  // 处理斜率为0的操作
  let x = coordinates[0][0]
  let flag = true
  for (let i = 1; i < coordinates.length; i++) {
    if (coordinates[i][0] !== x) {
      flag = false
    }
  }
  if (flag === true) {
    return true
  }
  let x1 = coordinates[0][0]
  let y1 = coordinates[0][1]
  let x2 = coordinates[1][0]
  let y2 = coordinates[1][1]
  let a = (y1 - y2) / (x1 - x2)
  let b = y1 - a * x1
  if (coordinates.length === 2) return true
  for (let i = 2; i < coordinates.length; i++) {
    if (a * coordinates[i][0] + b !== coordinates[i][1]) {
      return false
    }
  }
  return true
}
